package cn.gailvlun.gll.presentation.login;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;

import cn.gailvlun.gll.R;
import cn.gailvlun.gll.databinding.ActivityNewPasswordBinding;
import cn.gailvlun.gll.presentation.base.BaseActivity;
import cn.gailvlun.gll.util.DialogUtil;
import cn.gailvlun.gll.widget.NavigationBarView;



@Deprecated
public class NewPasswordActivity extends BaseActivity {

    private String mVerificationCode;
    private String mPhoneNumber;
    private ActivityNewPasswordBinding mBinding;

    public static void openActivity(Context context, String phoneNumber) {
        Intent intent = new Intent(context, NewPasswordActivity.class);
        intent.putExtra("phoneNumberWithCc", phoneNumber);
        context.startActivity(intent);
    }


    @Override
    protected void initComponent() {
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_new_password);
        mBinding.setPresenter(new Presenter());
    }

    @Override
    protected void createHandler() {
        mBinding.nbv.setOnBackListener(new NavigationBarView.OnBackListener() {
            @Override
            public void onBack(NavigationBarView nb) {
                onBackPressed();
            }
        });

    }

    @Override
    protected void loadData(@Nullable Bundle savedInstanceState) {
        Intent intent = getIntent();
        mPhoneNumber = intent.getStringExtra("phoneNumberWithCc");
    }

    @Override
    public void onBackPressed() {
        MaterialDialog.Builder builder = new MaterialDialog.Builder(mContext);
        builder.title(" 这是最后一步了，确定要退出吗 ？")
                .positiveText("再想想")
                .negativeText("退出")
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        dialog.dismiss();
                    }
                })
                .onNegative(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        dialog.dismiss();
                        LoginActivity.openActivity(mContext, false);

                    }
                })
                .show();
    }

    public class Presenter {
        public void onFinish() {
            final Dialog pd = DialogUtil.showIndeterminate(mContext);


















        }
    }
}
